<?php defined('_JEXEC') or die('Restricted access'); ?>

<?php  JHTML::_('behavior.tooltip');  ?>

<?php  
	JToolBarHelper::title( 'Zarządzanie przeniesieniami', 'przeniesienie.png' );
	JToolBarHelper::pdf();
	global $button_utworz;
	if ( $button_utworz == true ) {
		JToolBarHelper::addNewX();
	}
	//JToolBarHelper::help( 'screen.przeniesienia' );
?>

<form action="index.php?option=com_przeniesienia" method="post" name="adminForm">
	<table>
		<tr>
			<td width="100%">
				<input type="text" name="search" id="search" value="<?php echo htmlspecialchars($this->lists['search']);?>" class="text_area" onchange="document.adminForm.submit();" />
				<button onclick="this.form.submit();"><?php echo 'Szukaj'; ?></button>
				<button onclick="document.getElementById('search').value='';this.form.getElementById('filter_type').value='0';this.form.getElementById('filter_logged').value='0';this.form.submit();"><?php echo JText::_( 'Reset' ); ?></button>
			</td>
			<td nowrap="nowrap">
				<?php echo $this->lists['z_obiektu'];?>
				<?php echo $this->lists['na_obiekt'];?>
				<?php echo $this->lists['z_obiektu_sp'];?>
			</td>
		</tr>
	</table>

	<table class="adminlist" cellpadding="1">
		<thead>
			<tr>
				<th width="2%" class="title">
					lp
				</th>
				<th width="3%" class="title">
					<input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count($this->items); ?>);" />
				</th>
				<th width="5%" class="title">
					<?php echo JHTML::_('grid.sort', 'Numer przeniesienia', 'a.nr_przeniesienia', @$this->lists['order_Dir'], @$this->lists['order'] ); ?>
				</th>
				<th width="7%" class="title">
					<?php echo JHTML::_('grid.sort', 'Model', 'a.model', @$this->lists['order_Dir'], @$this->lists['order'] ); ?>
				</th>
				<th class="title">
					<?php echo JHTML::_('grid.sort', 'Nr inwentarzowy', 'a.nri', @$this->lists['order_Dir'], @$this->lists['order'] ); ?>
				</th>
				<th class="title">
					<?php echo JHTML::_('grid.sort', 'Obiekt przekazujący', 'a.z_obiektu', @$this->lists['order_Dir'], @$this->lists['order'] ); ?>
				</th>
				<th class="title">
					<?php echo JHTML::_('grid.sort', 'Obiekt odbierający', 'a.na_obiekt', @$this->lists['order_Dir'], @$this->lists['order'] ); ?>
				</th>
				<th width="5%" class="title">
					<?php echo JHTML::_('grid.sort', 'Zmiana spółki', 'a.zm_sp', @$this->lists['order_Dir'], @$this->lists['order'] ); ?>
				</th>
				<th width="12%" class="title">
					<?php echo JHTML::_('grid.sort', 'Status transakcji', 's.status', @$this->lists['order_Dir'], @$this->lists['order'] ); ?>
				</th>
				<th width="12%" class="title">
					<?php echo JHTML::_('grid.sort', 'Data transakcji', 's.registerDate', @$this->lists['order_Dir'], @$this->lists['order'] ); ?>
				</th>
			</tr>
		</thead>
		<tfoot>
			<tr>
				<td colspan="10">
					<?php echo $this->pagination->getListFooter(); ?>
				</td>
			</tr>
		</tfoot>
		<tbody>
		<?php
			$k = 0;
			for ($i=0, $n=count( $this->items ); $i < $n; $i++)
			{
				$row 	=& $this->items[$i];
				
				$link 	= 'index.php?option=com_przeniesienia&amp;task=detals&amp;cid[]='. $row->gid. '';
		?>
			<tr class="<?php echo "row$k"; ?>">
				<td>
					<?php echo $i+1+$this->pagination->limitstart;?>
				</td>
				<td>
					<?php echo JHTML::_('grid.id', $i, $row->gid ); ?>
				</td>
				<td style="text-align:center">
					<a href="<?php echo $link; ?>"><?php echo $row->nr_przeniesienia; ?></a>
				</td>
				<td>
					<?php echo $row->model; ?>
				</td>
				<td>
					<?php echo $row->nri; ?>
				</td>
				<td>
					<?php echo $row->z_obiektu; ?>
				</td>
				<td>
					<?php echo $row->na_obiekt; ?>
				</td>
				<td>
					<?php echo $row->zm_sp ? 'TAK' : 'NIE'; ?>
				</td>
				<td>
					<?php echo $row->status ; ?>
				</td>
				<td>
					<?php echo $row->registerDate; ?>
				</td>
			</tr>
			<?php
				$k = 1 - $k;
				}
			?>
		</tbody>
	</table>

	<input type="hidden" name="option" value="com_przeniesienia" />
	<input type="hidden" name="task" value="" />
	<input type="hidden" name="boxchecked" value="0" />
	<input type="hidden" name="filter_order" value="<?php echo $this->lists['order']; ?>" />
	<input type="hidden" name="filter_order_Dir" value="<?php echo $this->lists['order_Dir']; ?>" />
</form>